﻿<common:LayoutAwarePage
    x:Name="pageRoot"
    x:Class="PlayToReceiver.MainPage"
    DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:PlayToReceiver"
    xmlns:common="using:PlayToReceiver.Common"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Page.Resources>
        <x:String x:Key="AppName">Play To Receiver</x:String>
        <Style x:Key="LayoutRootStyle" TargetType="Panel">
            <Setter Property="Background" Value="{ThemeResource ApplicationPageBackgroundThemeBrush}"/>
            <Setter Property="ChildrenTransitions">
                <Setter.Value>
                    <TransitionCollection>
                        <EntranceThemeTransition/>
                    </TransitionCollection>
                </Setter.Value>
            </Setter>
        </Style>
    </Page.Resources>

    <Grid Style="{StaticResource LayoutRootStyle}">
        <Grid.RowDefinitions>
            <RowDefinition Height="140" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <!-- Back button and page title -->
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <Button x:Name="backButton" Click="GoBack" IsEnabled="{Binding Frame.CanGoBack, ElementName=pageRoot}"
                    Style="{StaticResource NavigationBackButtonNormalStyle}" />
            <TextBlock x:Name="pageTitle" Grid.Column="1" Text="{StaticResource AppName}"
                       Style="{StaticResource HeaderTextBlockStyle}" />
            <ToggleSwitch Header="Receiver Broadcast" Grid.Column="1" HorizontalAlignment="Right" Margin="0,0,50,0" Toggled="ToggleSwitch_Toggled" />
        </Grid>

        <Rectangle Grid.Row="1" Fill="#FF3C3C3C" />
        <MediaElement x:Name="VideoPlayer" Margin="19" Grid.Row="1" />

    </Grid>
</common:LayoutAwarePage>